package com.shop.cereshop.business.service.tool.impl;

import com.shop.cereshop.business.dao.tool.CereShopDiscountDetailDAO;
import com.shop.cereshop.business.page.tool.ToolProduct;
import com.shop.cereshop.business.service.tool.CereShopDiscountDetailService;
import com.shop.cereshop.commons.domain.tool.CereShopDiscountDetail;
import com.shop.cereshop.commons.exception.CoBusinessException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CereShopDiscountDetailServiceImpl implements CereShopDiscountDetailService {

    @Autowired
    private CereShopDiscountDetailDAO cereShopDiscountDetailDAO;

    @Override
    public void insertBatch(List<CereShopDiscountDetail> list) throws CoBusinessException {
        cereShopDiscountDetailDAO.insertBatch(list);
    }

    @Override
    public void deleteById(Long shopDiscountId) throws CoBusinessException {
        cereShopDiscountDetailDAO.deleteById(shopDiscountId);
    }

    @Override
    public List<ToolProduct> findProducts(Long shopDiscountId) {
        return cereShopDiscountDetailDAO.findProducts(shopDiscountId);
    }

    @Override
    public List<ToolProduct> findDistinctProducts(Long shopDiscountId) {
        return cereShopDiscountDetailDAO.findDistinctProducts(shopDiscountId);
    }
}
